//
//  NSObject+name.m
//  Runtime给Model赋值
//
//  Created by MyMac on 15/8/25.
//  Copyright (c) 2015年 MyMac. All rights reserved.
//

#import "NSObject+name.h"
#import <objc/runtime.h>
@implementation NSObject (name)
static char key;
-(void)setName:(NSString *)name
{

    objc_setAssociatedObject(self, &key, name, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    NSLog(@"%c",key);





}
-(NSString*)name
{
    NSLog(@"%c",key);

    return objc_getAssociatedObject(self, &key);



}
//关联的key必须不一样
static char viewKey;
-(void)setCategoryView:(UIView *)categoryView
{

    objc_setAssociatedObject(self, &viewKey, categoryView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

}
//动态的删除属性    objc_removeAssociatedObjects();
-(UIView*)categoryView
{

  return  objc_getAssociatedObject(self, &viewKey);

}
@end
